package com.lin.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface AccountMapper {
    @Update("update account set money = money + #{money} where name = #{to}")
    int transferOut(@Param("from")String from, @Param("to")String to, @Param("money")Integer money);

    @Update("update account set money = money - #{money} where name = #{to} and money - #{money} > 0")
    int transferIn(@Param("from")String from, @Param("to")String to, @Param("money")Integer money);
}
